<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title>修改密码</title>
    <link rel="stylesheet" href="css/main.css" />
    <link rel="stylesheet" href="css/resetpass.css" />
    <link rel="stylesheet" href="iconfont/iconfont.css" />
</head>
<body>
    <!--header开始-->
      <header>
      	<div class="iconfont icon-fanhui mui-action-back" style="font-size:0.34rem"></div>
      	<div style="font-size:0.34rem;color:#fff;">修改密码</div>
      </header>
    <!--header结束-->
    <!--表单的开始-->
    <form action="" class="form">
     	<!--旧密码-->
        <div  class="username">
    		<div>
    		<img src="img/icon_code@2x.png" alt=""  style="width:0.32rem;height:0.40rem;margin-right:0.35rem;"/>
    		<input type="password" name="userpassAgain" placeholder="请输入原始密码"  id="oldpass" />
    		</div>
    	</div>
    	<!--新密码-->
        <div  class="username">
    		<div>
    		<img src="img/icon_code@2x.png" alt=""  style="width:0.32rem;height:0.40rem;margin-right:0.35rem;"/>
    		<input type="password" name="userpass" placeholder="请输入新密码"  id="newpass"/>
    		</div>
    	</div>
    	<!--确认密码-->
        <div  class="username">
    		<div>
    		<img src="img/icon_code@2x.png" alt=""  style="width:0.32rem;height:0.40rem;margin-right:0.35rem;"/>
    		<input type="password" name="userpassAgain" placeholder="确认密码"  id="conpass"/>
    		</div>
    	</div>
    	<div class="next">重置密码</div>
    </form>
    <!--表单的结束-->
</body>
<script type="text/javascript" src="js/pxtorem.js"></script>
<script src="js/mui.js"></script>
<script src="js/apptool.js"></script>
<script>
	mui.init();
	var dom = {
		oldpass:mui('#oldpass')[0],
		newpass:mui('#newpass')[0],
		conpass:mui('#conpass')[0],
	}
	mui('.next')[0].addEventListener('tap',function(){
		if(!dom.oldpass.value){
			mui.toast('旧密码不能为空');
			return;
		}else{
			if(!dom.newpass.value){
				mui.toast('新密码不能为空');
				return;
			}else{
				if(!dom.conpass.value){
					mui.toast('确认密码不能为空');
				    return;
				}else{
					if(apptools.checkpass(dom.oldpass.value)){
						if(apptools.checkpass(dom.newpass.value)){
							if(apptools.checkpass(dom.conpass.value)){
								if(dom.newpass.value==dom.conpass.value){
									mui.ajax('',{
										data:{
											oldpass:dom.oldpass.value,
											newpass:dom.newpass.value,
											conpass:dom.conpass.value,
										},
										dataType:'json',
										type:'post',
										headers:{'Content-Type':'application/json'},
										success:function(data){
											data=JSON.stringify(data);
											console.log(data);
										},
										error:function(xhr,type,errorThrown){
											console.log(xhr);
										}
									})
								}else{
									mui.toast('两次密码输入不一致');
									return;
								}
							}
						}
					}
				}
			}
		}
	})
</script>
</html>